package com.flyoil.petromp.base;

import android.app.Activity;
import android.app.Application;

import com.flyoil.petromp.utils.ApplicationHelp;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by songzhiiyn on 2017/9/25.
 */

public class MyApplication extends Application {
    private static List<Activity> mList = new LinkedList<Activity>();
    @Override
    public void onCreate() {
        super.onCreate();
        ApplicationHelp.init_ibraries(this);
    }
    /**
     * 添加Activity的方法
     *
     * @param activity
     */
    public static void addActivity(Activity activity) {
        mList.add(activity);
    }

    /**
     * 关闭activity的方法
     */
    public static void exitActivity() {
        try {
            for (Activity activity : mList) {
                if (activity != null)
                    activity.finish();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {

        }
    }
}
